Ternary 三元運算子


Posted by Rich on 2021-04-22

console.log(10 > 5 ? 'bigger' : 'smaller')
output:bigger

condition ? true : false
條件 ? true就執行 : false就執行


#note







Related Posts

淺談 AJAX、JSONP 和 CORS

淺談 AJAX、JSONP 和 CORS

Nuxt(3) - store & 生命週期

Nuxt(3) - store & 生命週期

HTB Reel Walkthrough

HTB Reel Walkthrough


Comments